package clientApp.gui;

import javax.swing.JToolBar;
import javax.swing.JComboBox;
import javax.swing.JToggleButton;
import javax.swing.ImageIcon;

public class TextToolbar extends JToolBar {
	private JComboBox fontSizeComboBox;
	private JToggleButton boldButton;
	private JToggleButton italicButton;
	private JToggleButton underlineButton;
	private String[] fontSize = {"6","7","8","9","10","12","14","16","18","20","22"};
	
	public TextToolbar() {
		
		fontSizeComboBox = new JComboBox();
		for (int i = 0; i < fontSize.length; i++){
			fontSizeComboBox.addItem(fontSize[i]);
		}
		fontSizeComboBox.setSelectedIndex(5);
		add(fontSizeComboBox);
		
		boldButton = new JToggleButton("");
		boldButton.setMnemonic('B');
		boldButton.setIcon(new ImageIcon(TextToolbar.class.getResource("/resources/icons/edit-bold.png")));
		add(boldButton);
		
		italicButton = new JToggleButton("");
		italicButton.setMnemonic('I');
		italicButton.setIcon(new ImageIcon(TextToolbar.class.getResource("/resources/icons/edit-italic.png")));
		add(italicButton);
		
		underlineButton = new JToggleButton("");
		underlineButton.setMnemonic('U');
		underlineButton.setIcon(new ImageIcon(TextToolbar.class.getResource("/resources/icons/edit-underline.png")));
		add(underlineButton);
		
		
	}

	public JComboBox getFontSizeComboBox() {
		return fontSizeComboBox;
	}

	public JToggleButton getBoldButton() {
		return boldButton;
	}

	public JToggleButton getItalicButton() {
		return italicButton;
	}

	public JToggleButton getUnderlineButton() {
		return underlineButton;
	}

	public int getFontSize() {
		return Integer.parseInt(fontSize[fontSizeComboBox.getSelectedIndex()]);
	}
	
	

}
